import { createRouter, createWebHistory } from 'vue-router'
//import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // {
    //   path: '/article',
    //   component: () => import('@/views/article/ArticleContainer.vue')
    // },
    {
      path: '/',
      meta: { title: '登录' },
      component: () => import('../views/Login.vue')
    },
    {
      path: '/login',
      redirect: '/'
    },
    {
      path: '/index',
      meta: { title: 'Bing酒店信息综合平台' },
      component: () => import('../views/Index.vue'),
      children: [
        {
          path: '',
          meta: { title: '首页' },
          component: () => import('../views/Home.vue')
        },
        {
          path: '/mail',
          meta: { title: '邮件' },
          component: () => import('../views/Mail.vue')
        },
        {
          path: '/message',
          meta: { title: '消息' },
          component: () => import('../views/Message.vue')
        },
        {
          path: '/mine',
          meta: { title: '个人中心' },
          component: () => import('../views/user/Mine.vue')
        },
        {
          path: '/setpwd',
          meta: { title: '修改密码' },
          component: () => import('../views/user/SetPwd.vue')
        },
        {
          path: '/role',
          meta: { title: '角色管理' },
          component: () => import('../views/user/Role.vue')
        },
        {
          path: '/user',
          meta: { title: '用户管理' },
          component: () => import('../views/user/User.vue')
        },
        {
          path: '/roomtype',
          meta: { title: '房型管理' },
          component: () => import('../views/room/RoomType.vue')
        },
        {
          path: '/room',
          meta: { title: '房间管理' },
          component: () => import('../views/room/Room.vue')
        },
        {
          path: '/livein',
          meta: { title: '入住管理' },
          component: () => import('../views/custom/LiveIn.vue')
        },
        {
          path: '/order',
          meta: { title: '订单管理' },
          component: () => import('../views/custom/Order.vue')
        },
        {
          path: '/menu',
          meta: { title: '菜单管理' },
          component: () => import('../views/system/Menu.vue')
        },
        {
          path: '/dictionary',
          meta: { title: '字典管理' },
          component: () => import('../views/system/Dictionary.vue')
        },
        {
          path: '/employ',
          meta: { title: '菜单管理' },
          component: () => import('../views/user/Employ.vue')
        },
        {
          path: '/messageprocess',
          meta: { title: '消息处理' },
          component: () => import('../views/csr/MessageProcessingView.vue'),
          children:[
            {
              path: 'chat/:userId',
              name: 'Chat',
              component: ()=>import('../components/csr/Chat.vue'),
              props: true // 确保传递 params 作为 props
            }
          ]
        }
      ]


    }
  ],
})

export default router
